eponge is a small package, which facilitates selective object removal. It was released on CRAN at 23th March 2020. Initially, the package was named sponge, but during first submission trial I found out, that currently there exists the SPONGE package, availbale on BioConductor. Because of that, I decided to rename my package, changing only one letter. The package was given a new name: eponge, which simply means sponge in French. Let me present, what the package was created for.

Removing objects by name

Typically, when we want to remove all objects from the global environment, we can use click the broom icon in RStudio (supposing we use this IDE - but in most cases, we do). Alternatively, we can obtain the same results combining rm with ls.

# Remove all the objects
rm(list = ls())
# Remove object with 'iris' in its name
rm(list = ls(pattern = "iris"))

eponge offers a an equivalent shortcut: erase function. It’s particularly handy when we want to select some set of objects using regex pattern.

# Remove all the objects
eponge::erase() 
# Remove object with 'iris' in its name
eponge::erase("iris")

Removing objects by type